<!DOCTYPE html>
<html lang="zh-cn">

    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="shortcut icon" href="./img/logo.png">
        <title>查看/编辑</title>
        <script src="./js/open-web-editor.min.js"></script>
        <script src="./js/uni.webview.1.5.2.js"></script>
        <link rel="stylesheet" href="./css/style.css">
    </head>

    <body>
        <div id="root"></div>
        <script>
            // https://www.npmjs.com/package/open-web-editor
            var owe = new OpenWebEditor({
                el: document.getElementById('root'),
                color: {
                    background: "white"
                },
                content: decodeURIComponent((window.location.href + "").split('?')[1])
            });

            // 编辑器管理的文本发生改变后会主动触发
            owe.updated(function() {
                uni.postMessage({
                    data: {
                        value: encodeURIComponent(owe.valueOf())
                    }
                });
            });
        </script>
    </body>

</html>
